home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
tex
/
texsrc.arc
/
TIME.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-09-14
|
831b
|
39 lines
/* simple time functions NOT UNIX compatible but they
suit some purposes */
#include <osbind.h>
#include "time.h"
long time(ttime)
long *ttime;
{
int ttvec[2];
long daytime;
daytime=Gettime();
ttvec[0]=(daytime & 0xffff);
ttvec[1]=(daytime>>16) & 0xffff;
Tsettime(ttvec[0]);
Tsetdate(ttvec[1]);
if((ttime != NULL) )*ttime=daytime;
return(daytime);
}
struct tm *localtime(daytime)
long *daytime;
{
int ttvec[2];
static struct tm tt;
ttvec[0]=(*daytime & 0xffff);
ttvec[1]=(*daytime>>16) & 0xffff;
tt.tm_sec= (ttvec[0]&31)*2;
tt.tm_min= (ttvec[0]>>5)&63;
tt.tm_hour= (ttvec[0]>>11)&31;
tt.tm_mday= (ttvec[1]&31);
tt.tm_mon= ((ttvec[1]>>5)&15)-1;
tt.tm_year= ((ttvec[1]>>9)&127)+80;
tt.tm_isdst= 0;
return (&tt);
}